<?php

use yii\helpers\Html;
use yii\grid\GridView;
use yii\widgets\Pjax;
use yii\widgets\ActiveForm;

//use mdm\admin\components\AccessControl;
/* @var $this yii\web\View */
/* @var $searchModel ua_backend\models\search\UserSearch */
/* @var $dataProvider yii\data\ActiveDataProvider */

$this->title = "已核销";

$this->params['breadcrumbs'][] = $this->title;

?>

<div class="box">
    <div class="box-header with-border">

        <div class="action-btn col-sm-2 no-padding">
        </div>

        <div class="search-box flex flex-end  col-sm-10 no-padding">
            <?php $form = ActiveForm::begin([
                            'action' => ['verified'],
                            'method' => 'get',
                            'id' => 'search-form',
                            'options' => ['class' => 'form-horizontal'],
                        ]); ?>
                            <div class='input-group input-group-sm' style='width: 300px;margin-top:5px;'>
                            <?= $form->field($searchModel, 'skey',[
                                  'options'=>['class'=>'input-group input-group-sm','style'=>'width: 300px;'],
                                  'inputOptions' => ['placeholder' => Yii::t('app', 'Search Keyword'),'class' => 'form-control pull-right'],
                                    ])->label(false); ?>
                             <div class="input-group-btn">
                                <button class="btn btn-default" type="submit">
                                <i class="fa fa-search"></i>
                                </button>
                             </div>
                             </div>

            <?php ActiveForm::end(); ?>
        </div>    
    </div>    
    
<?php Pjax::begin(); ?> 

<?= GridView::widget([
    'dataProvider' => $dataProvider,
    'layout' => '<div class="box-body">{items}</div>
                         <div class="box-footer">
                            {summary}
                            <div class="_pager">{pager}</div>
                         </div>',
 
        'columns' => [
            'id' => [
                    'attribute' => 'id',
                    'enableSorting' => false,
                    'label' => 'UID',
                ],
            
                'avatar' => [
                    'attribute' => 'avatar',
                    'format' => ['image',['width'=>'40','height'=>'40']],
                    'label' => Yii::t('app', 'Avatar'),
                    'enableSorting' => false,
                ],

                'nickname' => [
                    'attribute' => 'nickname',
                    'label' => Yii::t('app', 'Nickname'),
                    'enableSorting' => false,
                    'value' => function ($model) {
                        return urldecode($model->nickname);
                    }
                ],

                'giftcode' => [
                    'attribute' => 'giftcode',
                    'label' => '礼品码',
                    'enableSorting' => false
                ],
                
                [
                    'attribute' => 'created_at',
                    'label' => Yii::t('app', 'Created at'),
                    'format' => ['date', 'php:Y-m-d H:i:s'],
                    'enableSorting' => false,
                ],


                [
                    'attribute' => 'status',
                    'enableSorting' => false,
                    'label' => Yii::t('app', 'Status'),
                    'format' => 'html',
                    'value' => function ($model) {
                        return '<span class="label label-success">已核销</span>';
                    }
                ],
        ],
    ]); ?>
<?php Pjax::end(); ?>
</div>

<?php
//记录当前页面
$url = Yii::$app->request->getHostInfo().Yii::$app->request->url;
Yii::$app->user->setReturnUrl($url);
?>
